﻿#ifndef JFILEPARSE_GLOBAL_H
#define JFILEPARSE_GLOBAL_H

#include <qglobal.h>
#include <QStringList>
#include <QDate>

// JFILEPARSE_VERSION is (major << 16) + (minor << 8) + patch.

#define JFILEPARSE_VERSION       0x000001
#define JFILEPARSE_VERSION_STR   "0.0.1"

#if defined(Q_WS_WIN) || defined(Q_OS_WIN) || defined(Q_WS_S60)

#if defined(_MSC_VER) // MSVC Compiler
// template-class specialization 'identifier' is already instantiated
#pragma warning(disable: 4660)
#pragma warning(disable: 4819)  // warning : 936
#endif // _MSC_VER

#ifdef JFILEPARSE_DLL

#if defined(JFILEPARSE_MAKEDLL)
#define JFILEPARSE_EXPORT  Q_DECL_EXPORT
#else
#define JFILEPARSE_EXPORT  Q_DECL_IMPORT

#if defined(_DEBUG) || defined(DEBUG)
#pragma comment(lib, "jplugins.fileparsed.lib")
#else
#pragma comment(lib, "jplugins.fileparse.lib")
#endif

#endif

#endif // JFILEPARSE_DLL

#endif // Q_WS_WIN || Q_WS_S60

#ifndef JFILEPARSE_EXPORT
#define JFILEPARSE_EXPORT
#endif

QT_BEGIN_HEADER

QT_BEGIN_NAMESPACE

// - namespace JFILEPARSE -
#define JFILEPARSE_NAMESPACE JFILEPARSE
#define JFILEPARSE_BEGIN_NAMESPACE namespace JFILEPARSE_NAMESPACE {
#define JFILEPARSE_END_NAMESPACE }
#define JFILEPARSE_USE_NAMESPACE using namespace JFILEPARSE_NAMESPACE;

// - private pointer
#ifndef J_DECLARE_PRIVATE
#define J_DECLARE_PRIVATE(name) \
    name ## Private *d_ptr; \
    Q_DECLARE_PRIVATE(name)
#endif

#ifndef J_DECLARE_PUBLIC
#define J_DECLARE_PUBLIC(name) \
    name *q_ptr; \
    Q_DECLARE_PUBLIC(name)
#endif

#ifndef J_DECLARE_SINGLE_INSTANCE
#define J_DECLARE_SINGLE_INSTANCE(Class) \
public: \
    static Class *instance(); \
    static void releaseInstance(); \
private: \
    static Class *_instance;
#endif

#ifndef J_IMPLEMENT_SINGLE_INSTANCE
#define J_IMPLEMENT_SINGLE_INSTANCE(Class) \
Class *Class::_instance = 0; \
\
Class *Class::instance() { \
    if (Class::_instance == 0) { \
        Class::_instance = new Class; \
    } \
    return Class::_instance; \
} \
\
void Class::releaseInstance() { \
    if (Class::_instance != 0) { \
        delete Class::_instance; \
        Class::_instance = 0; \
    } \
}
#endif

//
#include "jsqlcustomtype.h"

// 数据文件基本信息
struct JFileBaseInfo
{
    QString filePath;
    JFileNameInfo nameInfo;
    QStringList symbols;

    JFileBaseInfo()
    {

    }

    JFileBaseInfo(const JFileBaseInfo &other)
    {
        *this = other;
    }

    JFileBaseInfo &operator =(const JFileBaseInfo &other)
    {
        if (this == &other) {
            return *this;
        }

        filePath = other.filePath;
        nameInfo = other.nameInfo;
        symbols = other.symbols;

        return *this;
    }
};

// 信号筛选信息
struct JSignalSiftInfo
{
    bool selected;
    QString symbol;

    JSignalSiftInfo()
    {
        selected = false;
    }

    JSignalSiftInfo(const JSignalSiftInfo &other)
    {
        *this = other;
    }

    JSignalSiftInfo &operator =(const JSignalSiftInfo &other)
    {
        if (this == &other) {
            return *this;
        }

        selected = other.selected;
        symbol = other.symbol;

        return *this;
    }
};

#endif // JFILEPARSE_GLOBAL_H
